#ifndef __RSSREADER_H__
#define __RSSREADER_H__

#include "../../include/simhash/Simhasher.hpp"
#include <string>
#include <vector>
#include <unordered_set>

using std::string;
using std::vector;
using std::unordered_set;

using namespace simhash;

struct RssItem {
    string title;
    string link;
    string description;
    string content;
    string id;
};

class RssReader{
public:
    RssReader();
    void parseRss(const vector<string> &fileName);//解析
    void dumpWebLib(const string &outputFile);//输出网页库
    void dumpOffsetLib(const string &outputFile);//输出网页偏移库
    bool isRepeat(const string &sNew);
private:
    size_t getLength(const RssItem &);
private:
    Simhasher simhasher;
    vector<RssItem> _rss;
    vector<uint64_t> _simhash;
    unordered_set<uint64_t> _hash;
};  

#endif

